home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 October / Chip Ekim 2003.iso / prog / desktop / vizeon / setup.exe / AppDir\Vizeon Office\Editor\wysiwygsrc.js < prev    next >
Encoding:
Text File  |  2002-12-23  |  7.9 KB  |  313 lines

  1.  
  2. window.resizeTo(645,415);
  3.  
  4. //sPersistValue holds the value of the saved innerHTML 
  5. var sPersistValue
  6.  
  7. var viewMode = 1; 
  8.  
  9. function Init()
  10. {
  11. iView.document.designMode = 'On';
  12. getSystemFonts();
  13. getBlockFormats();
  14.  
  15. }
  16.  
  17. function selOn(ctrl)
  18. {
  19. ctrl.style.borderColor = 'threeddarkshadow';
  20. ctrl.style.backgroundColor = 'threedhighlight';
  21. ctrl.style.cursor = 'hand';    
  22. }
  23.  
  24. function selOff(ctrl)
  25. {
  26. ctrl.style.borderColor = 'threedface';  
  27. ctrl.style.backgroundColor = 'threedface';
  28. }
  29.  
  30. function selDown(ctrl)
  31. {
  32. ctrl.style.borderColor = 'threedface';
  33. ctrl.style.backgroundColor = 'threedface';
  34. }
  35.  
  36. function selUp(ctrl)
  37. {
  38. ctrl.style.borderColor = 'threedshadow';    
  39. ctrl.style.backgroundColor = 'threedlightshadow';
  40. }
  41.  
  42. function doToggleView()
  43. {  
  44. if(viewMode == 1)
  45. {
  46. iHTML = iView.document.body.innerHTML;
  47. iView.document.body.innerText = iHTML;
  48.  
  49. // Show  all controls
  50. //removed style controls that were otherwise here
  51. iView.focus();
  52.  
  53. viewMode = 2; // Code
  54. }
  55. else
  56. {
  57. iText = iView.document.body.innerText;
  58. iView.document.body.innerHTML = iText;
  59.  
  60. // Show all controls
  61. //removed style controls that were otherwise here
  62. iView.focus();
  63.  
  64. viewMode = 1; // WYSIWYG
  65. }
  66. }
  67.  
  68. function cmdExec(cmd,opt) 
  69. {
  70. iView.document.execCommand(cmd,"",opt);
  71. iView.focus();
  72. }
  73.  
  74. //preview control
  75. //dynamic preview template
  76. function previewControl() {
  77. ff = window.open("","","");
  78. ff.document.write("<html><head><title>Webpage Preview</title></head><body>"+iView.document.body.innerHTML+"</body></html>");
  79. }
  80.  
  81. function doFont(fName)
  82. {
  83. if(fName != '')
  84. iView.document.execCommand('fontname', false, fName);
  85. }
  86.  
  87. function doSize(fSize)
  88. {
  89. if(fSize != '')
  90. iView.document.execCommand('fontsize', false, fSize);
  91. }
  92.  
  93. function doHead(hType)
  94. {
  95. if(hType != '')
  96. {
  97. iView.document.execCommand('formatblock', false, hType);  
  98. doFont(selFont.options[selFont.selectedIndex].value);
  99. }
  100. }
  101.  
  102. function doLink()
  103. {
  104. iView.document.execCommand('createlink');
  105. }
  106.  
  107. function doRule()
  108. {
  109. iView.document.execCommand('inserthorizontalrule', false, null);
  110. }
  111.  
  112. // SHELL API FOR MS NOTEPAD
  113. function executeCommands(inputparms)
  114. {
  115. // Instantiate the Shell object and invoke 
  116. //its execute method.
  117.  
  118. var oShell = new ActiveXObject("Shell.Application");
  119.  
  120. var commandtoRun = "C:\\WINDOWS\\notepad.exe";
  121. if (inputparms != "")
  122. {
  123. var commandParms = iView.document.value;
  124. }
  125.  
  126. // Invoke the execute method.  
  127. oShell.ShellExecute(commandtoRun, commandParms, 
  128. "", "open", "1");
  129. }
  130. //ENDE SHELL API
  131.  
  132. function foreColor()
  133. {
  134. //----- Sets Foreground Color -----
  135. var fColor = showModalDialog("color.html","","dialogHeight: 300px; dialogWidth: 230px; dialogTop: 200px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
  136. if (fColor != null)
  137. {
  138. iView.document.execCommand("ForeColor", false, fColor);
  139. }
  140. iView.focus();
  141. }
  142.  
  143. function backColor()
  144. {
  145. //----- Sets Background Color -----
  146. var bColor = showModalDialog("color.html","","dialogHeight: 300px; dialogWidth: 230px; dialogTop: 200px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
  147. if (bColor != null)
  148. {
  149. iView.document.execCommand("BackColor", false, bColor);
  150. }
  151. iView.focus();
  152. }
  153.  
  154.  //table Dialog
  155. function addTableDialog()
  156. {
  157. var rtNumRows = null;
  158. var rtNumCols = null;
  159. var rtTblAlign = null;
  160. var rtTblWidth = null;
  161.  
  162. var rtTblSpacing = null;
  163. var rtTblPadding =  null;
  164. var rtTblColor = null;
  165. var rtTblBorder = null;
  166. var rtTblBorderColor = null;
  167.  
  168. showModalDialog("table.html",window,"status:no; dialogWidth: 370px; dialogHeight: 320px; help: 0");
  169. }
  170. function createTable()
  171. {
  172. var cursor = iView.document.selection.createRange();
  173. if (rtNumRows == "" || rtNumRows == "0")
  174. {
  175. rtNumRows = "1";
  176. }
  177. if (rtNumCols == "" || rtNumCols == "0")
  178. {
  179. rtNumCols = "1";
  180. }
  181. var rttrnum=1
  182. var rttdnum=1
  183. var rtNewTable = "<table  bordercolor='"+rtTblBorderColor+"' border='"+rtTblBorder+"' bgcolor='"+rtTblColor+"' cellpadding='"+rtTblPadding+"' cellspacing='"+rtTblSpacing+"' border='1' align='" + rtTblAlign + "' cellpadding='0' cellspacing='0' width='" + rtTblWidth + "' >"
  184. while (rttrnum <= rtNumRows)
  185. {
  186. rttrnum=rttrnum+1
  187. rtNewTable = rtNewTable + "<tr>"
  188. while (rttdnum <= rtNumCols)
  189. {
  190. rtNewTable = rtNewTable + "<td> </td>"
  191. rttdnum=rttdnum+1
  192. }
  193. rttdnum=1
  194. rtNewTable = rtNewTable + "</tr>"
  195. }
  196. rtNewTable = rtNewTable + "</table>"
  197. cursor.pasteHTML(rtNewTable);
  198. iView.focus();
  199. }
  200.  
  201. function popup6(ftp,ftpref)
  202. {
  203. if (! window.focus)return true;
  204. var href;
  205. if (typeof(ftp.html) == 'string')
  206. href=ftp.html;
  207. else
  208. href=ftp.html;
  209. window.open("ftp.html", 'ftpref', 'width=320, height=320, top=100, left=240, resizable=no, directories=no, location=no, toolbar=no, status=no, menubar=no, status=no, scrollbars=no');
  210. return false;
  211. }
  212.  
  213. function bugsome1(){
  214. who=prompt("Enter recipient's email address: ","bill@fromredmond.net");
  215. what=prompt("Enter the subject: ","-say something here-");
  216. if (confirm("Are you sure you want to mail "+who+" with the subject of "+what+"?"+"  if so, select and copy editor contents into email text area's window when it comes up")==true){
  217. parent.location.href='mailto:'+who+'?subject='+what+'';
  218. }
  219. }
  220.  
  221. function alibi() {
  222.  window.showModelessDialog("about.html" , "ProtoPad V 2.0.0" , "dialogHeight:455px; dialogWidth:320px; resizable:0; scrollbars:0; status:0 ; help:0; dialogTop=70px; dialogLeft:221px")
  223. }
  224.  
  225. //begin help window code
  226. //copy this code into the <HEAD> of your webpage. Make sure you specify an event for the function, e.g. onLoad="alibi()"
  227.  
  228. function helpfile() {
  229.  window.showModelessDialog(" help.html" , "" , "dialogHeight:450px; dialogWidth:485px; resizable:yes; scrollbars:yes; status:no ; dialogTop=70px; dialogLeft:150px")
  230. }    
  231. //ende help window code
  232.  
  233. function upper() {
  234. str = iView.document.body.innerHTML = iView.document.body.innerHTML;
  235. iView.document.body.innerHTML = iView.document.body.innerHTML.toUpperCase()
  236. }
  237.  
  238. function lower() {
  239. str = iView.document.body.innerHTML = iView.document.body.innerHTML;
  240. iView.document.body.innerHTML = iView.document.body.innerHTML.toLowerCase()
  241. }
  242.  
  243. //insert symbol
  244. function mySymbol()
  245. {
  246. var symbol = null;
  247. showModalDialog("symbol.html",window,"dialogHeight: 200px; dialogWidth: 170px; dialogTop: 200px; dialogLeft: 150px; edge: Sunken; center: Yes; help: No; resizable: No; status: No;");
  248. }
  249. function createSymbol()
  250. {
  251. var cursor = iView.document.selection.createRange();
  252.  
  253. var rtNewTable = ""+symbol+"" 
  254.  
  255. cursor.pasteHTML(rtNewTable);
  256. iView.focus();
  257. }
  258.   
  259. //auf wiedersehen
  260. function finito() {
  261. if (confirm('You may now lose any unsaved information.\n\nAre you sure you want to exit ProtoPad? '))
  262. window.close();
  263. else return;
  264. }
  265.  
  266. //insert image
  267. function insImg()
  268. {
  269. var imageAlt = null;
  270. var imageSrc = null;
  271. var units = null;
  272. var border = null;
  273. showModalDialog("imgsrc.html",window,"status:no; dialogWidth: 310px; dialogHeight: 147px; help: 0");
  274. }
  275. function addImageToPage()
  276. {
  277. var cursor = iView.document.selection.createRange();
  278.  
  279. var rtNewTxt = "<img src=\""+imageSrc+"\" alt='" + imageAlt + "'  border='"+border+"'>"
  280.  
  281. cursor.pasteHTML(rtNewTxt);
  282. iView.focus();
  283. }
  284.  
  285. //update via asp page in root directory
  286.   function doUpdate()
  287. {
  288.    //----- Update User Input ------
  289.    //==============================================
  290.    //= To change the url that the ProtoPad posts to =
  291.    //= change the action url in the form at the   =
  292.    //= bottom of the page protopad.html, ie the Microsoft link in the form named ppadeditor.                   
  293.    //==============================================
  294.    if (iView.document.body.innerHTML == "")
  295.    {
  296.       return;
  297.    }
  298.    else
  299.    {
  300.       if (confirm("Would you like to submit ProtoPad's contents\n\nto update your file?"))
  301.       {
  302.          var dataRep = null;
  303.          dataRep = document.body.all.submitData;
  304.          dataRep.value = iView.document.body.innerHTML;
  305.          document.ppadeditor.submit();
  306.       }
  307.       else
  308.       {
  309.          return;
  310.       }
  311.    }
  312. }
  313.